﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using mx.ipn.escom.tt20080015.modelo.db;

namespace tt20080015.vistas.especialista
{
    public partial class Pacientes : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if(Session["user"] == null)
                Server.Transfer("~/Default.aspx", false);
        }

        protected void buscarButton_Click(object sender, EventArgs e)
        {
            PacienteManager p = new mx.ipn.escom.tt20080015.modelo.db.PacienteManager();
            DataSet ds = p.GetPacientesByNombre(buscaTextBox.Text);
            pacienteGridView.DataSource = ds;
            pacienteGridView.DataMember = "pacientes";
            pacienteGridView.DataBind();
        }

        protected void consultarButton_Click(object sender, EventArgs e)
        {
            Context.Items.Add("Id", pacienteGridView.SelectedValue);
            Server.Transfer("././Paciente.aspx");
        }

        protected void hola(object sender, EventArgs e)
        {
            consultarButton.Visible = true;
        }
    }
}
